﻿@using eLoan;
@using eLoan.Models;

@{
    
    var access = AdministrationHelper.GetUserAccess(new DatabaseContext(), User.Identity.Name);
}


<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="sidebar-collapse">
        @if(User.Identity.IsAuthenticated)
        { 
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    <img src="~/Documents/eqglogo.png" height="90" width="175" style="margin-left:-6px"/>
                </div>
            </li>

            <li class="@Html.IsSelected(controller: "Home")">
                <a><i class="fa fa-home"></i><span class="nav-label">Home</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    <li><a href="@Url.Action("Index", "Home")">Weather Forecast</a></li>
                </ul>
            </li>

            @if (access.HasAdministrationAccess)
            {
            <li class="@Html.IsSelected(controller: "Administration")">
                <a><i class="fa fa-gears"></i><span class="nav-label">Administration</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    @if (access.HasUsersAccess)
                    {
                    <li><a href="@Url.Action("Users", "Administration")">Users</a></li>}
                    @if (access.HasBanksAccess)
                    {
                        <li><a href="@Url.Action("Banks", "Administration")">Banks</a></li>}
                    @if (access.HasBanksAccess)
                    {
                    <li><a href="@Url.Action("Branches", "Administration")">Branches</a></li>}
                    @if (access.HasAgentsAccess)
                    {
                    <li><a href="@Url.Action("Agents", "Administration")">Agents</a></li>}
                    @if (access.HasLoanTypesAccess)
                    {
                    <li><a href="@Url.Action("LoanTypes", "Administration")">Loan Types</a></li>}
                    @if (access.HasChargeTypesAccess)
                    {
                    <li><a href="@Url.Action("ChargeTypes", "Administration")">Charge Types</a></li>}
                    @if (access.HasPaymentTypesAccess)
                    {
                    <li><a href="@Url.Action("PaymentTypes", "Administration")">Payment Types</a></li>}
                    @if (access.HasNotificationsAccess)
                    {
                    <li><a href="@Url.Action("Notifications", "Administration")">Notifications</a></li>}
                </ul>
            </li>
            }
            
            @if (access.HasMasterFilesAccess)
            {
            <li class="@Html.IsSelected(controller: "Masterfile")">
                <a><i class="fa fa-files-o"></i><span class="nav-label">Masterfile</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    @if (access.HasAddressBookAccess)
                    {
                    <li><a href="@Url.Action("Borrowers", "Masterfile")">Address Book</a></li>}
                    @if (access.HasProspectsAccess)
                    {
                        <li><a href="@Url.Action("Prospects", "Masterfile")">Prospects</a></li>}
                </ul>
            </li>
            }

            @if (access.HasFundingsAccess)
            {
            <li class="@Html.IsSelected(controller: "Funding")">
                <a><i class="fa fa-diamond"></i><span class="nav-label">Funding</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    @if (access.HasLoansAccess)
                    {
                    <li><a href="@Url.Action("Loans", "Funding")">Create Loan</a></li>}
                    @if (access.HasLoansAccess)
                    {
                    <li><a href="@Url.Action("CancelLoan", "Funding")">Cancel Loan</a></li>}
                    @if (access.HasPrintChequeAccess)
                    {
                    <li><a href="@Url.Action("PrintCheque", "Funding")">Print Cheque</a></li>}
                    @if (access.HasPrintContractAccess)
                    {
                    <li><a href="@Url.Action("PrintContract", "Funding")">Print Contract</a></li>}
                    @if (access.HasReleaseToBranchAccess)
                    {
                    <li><a href="@Url.Action("ReleaseToBranch", "Funding")">Release to Branch</a></li>}
                    @if (access.HasReleaseToCustomerAccess)
                    {
                    <li><a href="@Url.Action("ReleaseToCustomer", "Funding")">Release to Customer</a></li>}
                </ul>
            </li>
            }
            
            @if (access.HasWorkspaceAccess)
            {
            <li class="@Html.IsSelected(controller: "Workspace")">
                <a><i class="fa fa-table"></i><span class="nav-label">Workspace</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    @if (access.HasLoanPaymentAccess)
                    {
                        <li><a href="@Url.Action("CashPayment", "Workspace")">Cash Payment</a></li>
                        <li><a href="@Url.Action("ChequePayment", "Workspace")">Cheque Payment</a></li>
                    }
                    @if (access.HasChequeClearingAccess)
                    {
                        <li><a href="@Url.Action("ChequeClearing", "Workspace")">Cheque Clearing</a></li>
                    }
                    @if (access.HasLoanPenaltyAccess)
                    { <li><a href="@Url.Action("LoanPenalty", "Workspace")">Loan Penalty</a></li>}
                    @if (access.HasVoidLoanPaymentAccess)
                    {
                    <li><a href="@Url.Action("VoidLoanPayment", "Workspace")">Void Loan Payment</a></li>}
                    @if (access.HasRequestCloseLoanAccess)
                    {
                    <li><a href="@Url.Action("RequestCloseLoan", "Workspace")">Request Close Loan</a></li>}
                    @if (access.HasCloseLoanAccess)
                    {
                        <li><a href="@Url.Action("CloseLoan", "Workspace")">Close Loan</a></li>}
                    @if (access.HasLoanNotificationAccess)
                    {
                    <li><a href="@Url.Action("LoanNotification", "Workspace")">Loan Notification</a></li>}
                    @if (access.HasDailyCollectionReconciliationAccess)
                    {
                    <li><a href="@Url.Action("CollectionReconciliation", "Workspace")">Daily Collection Reconciliation</a></li>}
                </ul>
            </li>
            }

            @if (access.HasReportsAccess)
            { 
            <li class="@Html.IsSelected(controller: "Report")">
                <a><i class="fa fa-edit"></i><span class="nav-label">Reports</span><span class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    @if (access.HasAgentItineraryAccess)
                    {<li><a href="@Url.Action("AgentItinerary", "Report")">Agent Itinerary</a></li>}
                    @if (access.HasCollectionReportAccess)
                    {<li><a href="@Url.Action("CollectionReport", "Report")">Collection Report</a></li>}
                    @if (access.HasSalesReportAccess)
                    {<li><a href="@Url.Action("SalesReport", "Report")">Sales Report</a></li>}
                    @if (access.HasChequeReportAccess)
                    {<li><a href="@Url.Action("ChequeReport", "Report")">Cheque Report</a></li>}
                    @if (access.HasSavingsReportAccess)
                    {<li><a href="@Url.Action("SavingsReport", "Report")">Savings Report</a></li>}
                    @if (access.HasSOAAccess)
                    {<li><a href="@Url.Action("SOAReport", "Report")">Statement of Account</a></li>}
                    @if (access.HasPenaltyHistoryAccess)
                    {<li><a href="@Url.Action("PenaltyHistory", "Report")">Penalty History</a></li>}
                    @if (access.HasClosedLoansReportAccess)
                    { <li><a href="@Url.Action("ClosedLoansReport", "Report")">Closed Loans Report</a></li>}
                    @if (access.HasDuePaymentsAccess)
                    {
                        <li><a href="@Url.Action("DailyDuePayments", "Report")">Daily Due Payments</a></li>
                        <li><a href="@Url.Action("OtherDuePayments", "Report")">Weekly, Semi-Monthly and Monthly Due Payments</a></li>
                    }
                    @if (access.HasDailyCollectionReconciliationReportAccess)
                    {<li><a href="@Url.Action("CollectionReconciliationReport", "Report")">Daily Collection Reconciliation Report</a></li>}
                    @if (access.HasAgingReportAccess)
                    {
                    <li><a href="@Url.Action("AgingReport", "Report")">Aging Report</a></li>}

                </ul>
            </li>
            }
        </ul>
        }
    </div>
</nav>
